import request from '../utils/request';

export const fetchData = query => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};
//登录
export function login(data) {
    return request({
        url: 'http://localhost:8089/user/login',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};

//查询我的考试
export function queryMyExams(data) {
    return request({
        url: 'http://localhost:8089/exam/queryMyExams',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};

//获取用户信息
export function getUserInfo(data) {
    return request({
        url: 'http://localhost:8089/user/getUserInfo',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//查询我的成绩
export function selectMyExamGrad(data) {
    return request({
        url: 'http://localhost:8089/grade/selectMyExamGrad',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//查询我的成绩
export function selectMySubject(data) {
    return request({
        url: 'http://localhost:8089/exam/selectMySubject',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//查询我的成绩
export function selectAllTeachers(data) {
    return request({
        url: 'http://localhost:8089/class/selectAllTeachers',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//更新个人信息
export function arrangeExamBySubject(data) {
    return request({
        url: 'http://localhost:8089/exam/arrangeExamBySubject',
        method: 'POST',
        data: JSON.stringify(data),
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//查询我的课程
export function selectMySubjectByParam(data) {
    return request({
        url: 'http://localhost:8089/exam/selectMySubjectByParam',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//查询我的成绩
export function selectClassGrad(data) {
    return request({
        url: 'http://localhost:8089/grade/selectClassGrad',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//查询考试人员
export function queryStudentsByExamId(data) {
    return request({
        url: 'http://localhost:8089/exam/queryStudentsByExamId',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
//更新个人信息
export function markGradeToStu(data) {
    return request({
        url: 'http://localhost:8089/grade/markGradeToStu',
        method: 'POST',
        data: JSON.stringify(data),
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
export function selectAllClassRoom(data) {
    return request({
        url: 'http://localhost:8089/class/selectAllClassRoom',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
export function changeClassRoomStatus(data) {
    return request({
        url: 'http://localhost:8089/class/changeClassRoomStatus',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};

export function selectExamInfoById(data) {
    return request({
        url: 'http://localhost:8089/exam/selectExamInfoById',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};

export function selectStudents(data) {
    return request({
        url: 'http://localhost:8089/student/selectStudents',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
export function addOrUpdateStudent(data) {
    return request({
        url: 'http://localhost:8089/student/addOrUpdateStudent',
        method: 'POST',
        data: JSON.stringify(data),
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
export function selectTeachers(data) {
    return request({
        url: 'http://localhost:8089/teacher/selectTeachers',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
export function addOrUpdateTeacher(data) {
    return request({
        url: 'http://localhost:8089/teacher/addOrUpdateTeacher',
        method: 'POST',
        data: JSON.stringify(data),
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
export function selectExamInfoByIdAdmin(data) {
    return request({
        url: 'http://localhost:8089/exam/selectExamInfoByIdAdmin',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
}
export function addOrUpdateSubject(data) {
    return request({
        url: 'http://localhost:8089/subject/addOrUpdateSubject',
        method: 'POST',
        data: JSON.stringify(data),
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
};
export function deleteSubject(data) {
    return request({
        url: 'http://localhost:8089/subject/deleteSubject',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
}
export function selectUnStudent(data) {
    return request({
        url: 'http://localhost:8089/subject/selectUnStudent',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
}
export function addStudentByExamId(data) {
    return request({
        url: 'http://localhost:8089/exam/addStudentByExamId',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
}
export function deleteStudentByExamId(data) {
    return request({
        url: 'http://localhost:8089/exam/deleteStudentByExamId',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
}
export function queryTeacherExamInfo(data) {
    return request({
        url: 'http://localhost:8089/exam/queryTeacherExamInfo',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
}
export function gradCharts(data) {
    return request({
        url: 'http://localhost:8089/exam/gradCharts',
        method: 'POST',
        params: data,
        headers: {"Content-Type": "application/json; charset=UTF-8","Authorization": window.localStorage.Authorization}
    })
}
